#include using namespace std; void main() { char phrase[1000]; cin.getline(phrase,1000); char word[100]; int wordIndex = 0; //example phrase //this is a test for(int i = 0; i <= strlen(phrase);i++) { word[wordIndex] = phrase[i]; //when a space or null terminator is found //that is the end of the word if(phrase[i] == ' ' || phrase[i] == '\0') { word[wordIndex] = '\0'; cout << word << endl; wordIndex = 0; } else { wordIndex++; } } } ////////////////////////////////////////////////////////////// #include using namespace std; void main() { char name[50]; char shortest[50]; char longest[50]; cout << "Name>"; cin.getline(name,50); strcpy(shortest,name); strcpy(longest,name); while(strcmp(name, "Quit") != 0) { cout << "Name>"; cin.getline(name,50); if(strlen(name) > strlen(longest)) { strcpy(longest,name); } if(strlen(name) < strlen(shortest)) { strcpy(shortest,name); } } cout << "Shortest name = " << shortest << endl; cout << "Longest name = " << longest << endl; }